ddns-scripts: add stop action for individual sections
authorPaul Donald <[email protected]>
Sat, 30 Nov 2024 15:19:12 +0000 (16:19 +0100)
committerFlorian Eckert <[email protected]>
Thu, 10 Apr 2025 07:34:38 +0000 (09:34 +0200)
it is now possible to stop an individual instance, and not all of them.

Signed-off-by: Paul Donald <[email protected]>
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_lucihelper.sh
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh

index c57e1cf39b1537c5ddc7794d9b606d68967cd1d2..e60b3daf6920d0d50a5449d2266d41cfd684ac2c 100644 (file)
@@ -26,6 +26,7 @@ Commands:
  start               start given SECTION
  reload              force running ddns processes to reload changed configuration
  restart             restart all ddns processes
+ stop                stop given SECTION
 
 Parameters:
  -6                  => use_ipv6=1          (default 0)
@@ -39,7 +40,7 @@ Parameters:
  -s SCRIPT           => ip_script=SCRIPT; ip_source="script"
  -t                  => force_dnstcp=1      (default 0)
  -u URL              => ip_url=URL; ip_source="web"
- -S SECTION          SECTION to start
+ -S SECTION          SECTION to [start|stop]
 
  -h                  => show this help and exit
  -L                  => use_logfile=1    (default 0)
@@ -161,6 +162,15 @@ case "$1" in
                sleep 1
                "$DDNSPRG" -- start
                ;;
+       stop)
+               if [ -n "$SECTION" ]; then
+                       # section stop
+                       "$DDNSPRG" -S "$SECTION" -- stop
+               else
+                       # global stop
+                       "$DDNSPRG" -- stop
+               fi
+               ;;
        *)
                __RET=255
                ;;
index 53099aae5c7bfcc1dbc231f4d19a55e492fba8be..4f599f6cbf892d0b9438cb3b33498cf8338b7e57 100644 (file)
@@ -79,7 +79,11 @@ case "$1" in
                fi
                ;;
        stop)
-               if [ -n "$INTERFACE" ]; then
+               if [ -n "$SECTION_ID" ]; then
+                       stop_section_processes "$SECTION_ID"
+                       exit 0
+               fi
+               if [ -n "$NETWORK" ]; then
                        stop_daemon_for_all_ddns_sections "$NETWORK"
                        exit 0
                else